package com.stx.chat.controller;

import com.stx.chat.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class MessageController {

    @Autowired
    MessageService messageService;

    @RequestMapping("/sendmessage")
    public Map<String,Object> sendMessage(Integer userId,String content){

        Map<String,Object> result = new HashMap<>();
        Integer msgId = messageService.sendMsg(userId,content);

        result.put("msgId",msgId);
        return result;

    }



}
